import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect:'login'
  },
  {
    path: '/home',
    name: 'home',
    component: HomeView,
    children:[
      {
        path: '/',
        redirect:'hotel'
      },
      {
        path: 'hotel',
        name: 'hotel',
        component: () => import('../components/HotelView.vue')
      },
      {
        path: 'order',
        name: 'order',
        component: () => import('../components/OrderView.vue')
      },
      {
        path: 'trip',
        name: 'trip',
        component: () => import('../components/TripView.vue')
      },
      {
        path: 'comment',
        name: 'comment',
        component: () => import('../components/CommentView.vue')
      },
    ]
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/LoginView.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
